package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 显示每个月第一天是星期几
 * Date:2021/4/3
 * ***************************************************************
 */
public class exc5_28 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		String[] months = {"January","February","March","April","May","Jun","July","August","September","October","November","December"};
		String[] days={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturay"};
		int[] numDays = {31,28,31,30,31,30,31,31,30,31,30,31};
		
		
		System.out.print("Enter the Year:  ");
		int year=input.nextInt();
		System.out.print("Enter the first day:  ");
		int first=input.nextInt();
		
		if(year%4==0&&year%100!=0||year%400==0) {
			numDays[1]=29;
		}
		
		for(int i=1;i<=12;i++) {
			if(i>1) {
				first=(first+numDays[i-1])%7;
			}
			//下面懒得用新的判断，就再下标里面加了条件表达式做数组下标
			System.out.printf("%s  1 , %d  is  %s\n",months[i-1],year,days[first]);
			
		}
		
		
		
	}

}
